package com.ms.oschina.fragment;

import java.io.IOException;
import java.util.List;

import android.view.ViewTreeObserver.OnGlobalLayoutListener;

import com.ms.oschina.adapter.AboutMeAdapter;
import com.ms.oschina.adapter.PageIndexListAdapter;
import com.ms.oschina.api.remote.OsChinaApi;
import com.ms.oschina.base.BaseListFragment;
import com.ms.oschina.bean.Active;
import com.ms.oschina.bean.ActiveList;
import com.ms.oschina.bean.Favorite;

/**
 * 包括At我和评论
 * @author Administrator
 *
 */
public class AboutMeFragment extends BaseListFragment<Active> {

	private AboutMeAdapter adapter;

	@Override
	public PageIndexListAdapter<Active> getAdapter() {
		adapter = new AboutMeAdapter(getListView(), getNetData(), true);
		int mark = getMark();
		adapter.setMark(mark);
		return adapter;
	}

	@Override
	protected void setEvent() {
	}

	@Override
	public List<Active> getNetData(int pageIndex) throws IOException {
		int mark = getMark();
		switch (mark) {
		case MessageFragment.ATME:
			return OsChinaApi
					.getAboutMeInfo(pageIndex, ActiveList.CATALOG_ATME);
		case MessageFragment.COMMENT:
			return OsChinaApi.getAboutMeInfo(pageIndex,
					ActiveList.CATALOG_COMMENT);
		}
		return null;
	}
}